package com.my.chapter12;

import jdk.internal.org.objectweb.asm.TypeReference;

public class practice10 {
    static void g() throws OneException{
        System.out.println("Originating the exception in g()");
        throw new OneException("thrown from g()");
    }
    static void f() throws TwoException{
        try {
            g();
        }catch (OneException e){
            e.printStackTrace(System.out);
            throw new TwoException("thrown from f()");
        }
    }


    public static void main(String[] args) {
        try {
            f();
        }catch (TwoException e){
            e.printStackTrace();
        }
    }
}

class OneException extends Exception{
    public OneException(){}
    public OneException(String msg){
        super(msg);
    }
}

class TwoException extends Exception{
    public TwoException(){}
    public TwoException(String msg){
        super(msg);
    }
}